﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Phoenix.Xna.Framework.Graphics;
using System.Windows;

namespace Phoenix.Xna.Framework.Presentation
{
    public class EffectTechniqueWrapper
    {
        private EffectTechnique _technique;
        public string Name
        {
            get { return _technique.Name; }
        }

        public List<EffectParameterWrapper> Parameters { get; set; }

        public EffectTechniqueWrapper(EffectTechnique technique)
        {
            _technique = technique;
            Parameters = new List<EffectParameterWrapper>();
        }

        public Technique GenerateTechnique()
        {
            Technique t = new Technique()
            {
                Name = Name
            };

            ParameterBindingCollection parameters = new ParameterBindingCollection();

            foreach (EffectParameterWrapper p in Parameters)
            {
                if (p.Serialize)
                {
                    parameters.Add(p.GenerateBinding());
                }
            }

            t.Parameters = parameters;
            return t;
        }
    }
}
